<?php
/****************************************************************************

	COPYRIGHT(C) WWW.MAXSI.DK, MAXSI SOFTWARE, SORTIE 2009
	ALL RIGHTS RESERVED

	Maxsi Distribution ContentServer/ Branch
	Scripts running a Maxsi Distribution Compatible Content Server.	
	
	uploadinstallscript.php
	Uploads the install script to the master server.

****************************************************************************/

	header('Transfer-Encoding: chunked');
	
	$ContentArchive		=	md_RequestParam('contentarchive');
	
	if ( !isset($ContentArchive) )
	{
		mdc_SendErrorDie('Failure: Missing contentarchive entities.');
	}
	
	if (!file_exists( 'addons/masterserver/scripts/'))
	{
		mkdir('addons/masterserver/scripts/',0700,true);
	}
	
	$Destination = 'addons/masterserver/scripts/' . md_ProductNameToFileName($ContentArchive) . '.mis';
	$TempFile = $_FILES['file']['tmp_name'];	

	copy($TempFile,$Destination);
	
	// If everything went right, do output 'Success'
	echo 'Success';
?>